﻿using System.Collections;
using System.Collections.Generic;
using UBlockly;
using UnityEngine;
using UBlockly.Scriptable;
using UnityEditor;

public static class BaseBlockMaker
{
    [MenuItem("BlockTool/生成条件block块")]
    public static void BuildConditionTypeBlock()
    {

    }
    
    [MenuItem("BlockTool/拷贝到工程目录")]
    public static void ddddd()
    {

    }

    public static void CreateNormalBlock(UBlockly.Graphic.BlockDescribeData describeData)
    {        
        var block = UBlockly.Graphic.BlockGraphic.CreateNode(describeData,true).Block;

        string path = string.Format("{0}/BlockAssets/GeneratorBlocks/{1}.{2}", Application.dataPath, describeData.FunctionName, "prefab");
        if (System.IO.File.Exists(path))
            System.IO.File.Delete(path);
        PrefabUtility.SaveAsPrefabAsset(block.gameObject, path);
        GameObject.DestroyImmediate(block.gameObject);
    }

}
